package com.example.service.impl;

import com.example.mapper.AuthorMapper;
import com.example.mapper.ArticlesMapper;
import com.example.pojo.JobOption;
import com.example.pojo.StudentOption;
import com.example.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ReportServicelmpl implements ReportService {
    @Autowired
    private AuthorMapper authorMapper;
    @Autowired
    private ArticlesMapper articlesMapper;


    @Override
    public List<Map<String, Object>> getAuthorGenderData() {
        return authorMapper.coutEmpGenderData();
    }



    @Override
    public StudentOption getArticlesCountData() {
        List<Map<String, Object>> List = articlesMapper.coutstudentCountData();
        List<Object> clazzList = List.stream().map(dataMap -> dataMap.get("pos")).toList();
        List<Object> dataList = List.stream().map(dataMap -> dataMap.get("num")).toList();
        return new StudentOption(clazzList, dataList);
    }
}
